package com.web.accountingEntry.entity;

import java.math.BigDecimal;
import java.time.LocalDate;

import com.fasterxml.jackson.annotation.JsonFormat;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@ToString
@ApiModel
@Getter
@Setter
public class AccountingEntry implements Cloneable {

	@ApiModelProperty("accountingItem")
	private String accountingItem;
	@ApiModelProperty("dealNo")
	private String dealNo;
	@ApiModelProperty("currency")
	private String currency;
	@ApiModelProperty("debitAmt")
	private BigDecimal debitAmt;
	@ApiModelProperty("creditAmt")
	private BigDecimal creditAmt;
	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyyMMdd")
	@ApiModelProperty("acDate")
	private LocalDate acDate;
	@ApiModelProperty("remark")
	private String remark;
	@ApiModelProperty("bankCode")
	private String bankCode = "001";
	@ApiModelProperty("counterparty")
	private String counterParty = "FXO";

	@Override
	public AccountingEntry clone(){
		try{
			return (AccountingEntry)super.clone();
		}catch (CloneNotSupportedException e){
			return null;
		}

	}

	public void updateValue(String item, BigDecimal drAmt,BigDecimal crAmt,LocalDate acDate){
		this.setDebitAmt(drAmt);
		this.setCreditAmt(crAmt);
		this.setAcDate(acDate);
		this.setAccountingItem(item);
	}
}
